//
//  FirstViewController.m
//  AutoCliamTest
//
//  Created by Taiping002 on 15/2/9.
//  Copyright (c) 2015年 Cisetech. All rights reserved.
//

#import "FirstViewController.h"
#import "AccoundUser.h"
#import "RootViewController.h"
#import "ProgressViewController.h"
#define  WIDTH  [[UIScreen mainScreen] bounds].size.width
#define  HEIGHT  [[UIScreen mainScreen] bounds].size.height
@interface FirstViewController ()<UITextFieldDelegate>
{

    UITextField * nameField;
    UITextField * policyField;
}
@end

@implementation FirstViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
#if 0
    UILabel * nameLabel =[[UILabel alloc]initWithFrame:(CGRectMake(10, 80, 60, 40))];
    nameLabel.text = @"姓名：";
    nameLabel.font = [UIFont systemFontOfSize:20];
    [self.view addSubview:nameLabel];
    [nameLabel release];
 nameField = [[UITextField alloc]initWithFrame:(CGRectMake(60, 80, WIDTH-60-10, 40))];
    nameField.delegate = self;
    nameField.backgroundColor = [UIColor grayColor];
    [self.view addSubview:nameField];
    
    
    
    UILabel * policyLabel =[[UILabel alloc]initWithFrame:(CGRectMake(10, 80+80, 80, 40))];
    policyLabel.text = @"保单号：";
    policyLabel.font = [UIFont systemFontOfSize:20];
    [self.view addSubview:policyLabel];
    [policyLabel release];
  policyField = [[UITextField alloc]initWithFrame:(CGRectMake(80, 80+80, WIDTH-60-30,40))];
    policyField.delegate = self;
    policyField.backgroundColor = [UIColor grayColor];
    [self.view addSubview:policyField];
#endif
    UIButton * button = [UIButton buttonWithType:(UIButtonTypeCustom)];
    button.frame = CGRectMake(WIDTH/2-40, 250, 80, 40);
    [button addTarget:self action:@selector(btn) forControlEvents:(UIControlEventTouchUpInside)];
    [button setBackgroundColor:[UIColor redColor]];
    [button setTitle:@"理赔" forState:(UIControlStateNormal)];
    [button setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)];
    [self.view addSubview:button];
    

    
    
   
}

//- (BOOL)textFieldShouldReturn:(UITextField *)textField{
//    [textField resignFirstResponder];
//    return YES;
//
//}

- (void)btn{
    NSString *textString = @"罗,440682199110195059,PC0200A005402162,2015-01-01,2015-03-01,13690659665,上海市浦东新区";
//    NSString *  textString=@"李四,320201199911111234,123454555,2015-01-01,2015-03-01,13812345678,上海市浦东新区";
    RootViewController * rvc = [[RootViewController alloc]init];
    BOOL  isDidClaim = [rvc isDidClaim:textString];
    if (isDidClaim) {
        
        ProgressViewController * pvc = [[ProgressViewController alloc]init];
        [self.navigationController pushViewController:pvc animated:NO];
        
    }else{
        
        [self.navigationController pushViewController:rvc animated:NO];
    }
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
